import VueRouter from 'vue-router';

const defaultRouterList = [
  {
    path: '/login',
    component: () => import('@/pages/login/index.vue'),
  }
];

const createRouter = () =>
  new VueRouter({
    routes: defaultRouterList,
    mode: "history",
    base: import.meta.env.VITE_BASE_URL,
    scrollBehavior () {
      return { y: 0 };
    },
  });

const router = createRouter();

export function resetRouter () {
  const newRouter = createRouter();
  router.matcher = newRouter.matcher; // reset router
  router.options.routes = [];
}

export default router;
